#include <stdio.h>

int main() {
    int N, X, arr[11];  
    scanf("%d", &N);
    for (int i = 0; i < N; i++) {
        scanf("%d", &arr[i]);
    }
    scanf("%d", &X);

    int i = N - 1;
    while (i >= 0 && arr[i] > X) {
        arr[i + 1] = arr[i];
        i--;
    }
    arr[i + 1] = X;
    N++;  
    for (int j = 0; j < N; j++) {
        printf("%d ", arr[j]);
    }

    return 0;
}
